package com.example.member.api.feign.factory;

import com.example.member.api.feign.MemberService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import  com.example.member.api.feign.fallback.MemberServiceFallbackImpl;

/**
 * @author 章侠杰
 */
@Component
public class MemberServiceFallbackFactory implements FallbackFactory<MemberService> {

    @Override
    public MemberService create(Throwable throwable) {
        MemberServiceFallbackImpl memberServiceFallback = new MemberServiceFallbackImpl();
        memberServiceFallback.setCause(throwable);
        return memberServiceFallback;
    }
}
